Exercise 1
library(tsibble)
library(fabletools)
library(dplyr)
library(plotly)
us_abs_path <- paste(rprojroot::find_rstudio_root_file(), "data", "Alcoholic Beverages Sales.csv", sep = "/")
us_abs <- read.csv(us_abs_path, stringsAsFactors = FALSE) %>%
setNames(c("date", "y")) %>%
mutate(index = yearmonth(as.Date(date))) %>%
select(-date) %>%
as_tsibble(index = index)
p1 <- us_abs %>% autoplot()
p1

ggplotly(p1)
Exercise 2
ca_elec_path <- paste(rprojroot::find_rstudio_root_file(), "data", "ca_elec.rda", sep = "/")
load(ca_elec_path)
ca_elec_ts <- ca_elec %>%
as_tsibble(index = date_time, key = operator)
p2 <- ca_elec_ts %>% autoplot()
p2

ggplotly(p2)